import { CommonEntity } from '../../../dto/common.entity';
import { IsNotEmpty } from 'class-validator';
import { Column, Entity } from 'typeorm';

export enum cardTypeType {
  TIME = 'time',
  DURATION = 'duration',
}

@Entity('card')
export class Card extends CommonEntity {
  @Column({
    comment: '名称',
    default: '',
  })
  name: string;

  @Column({
    comment: '卡类型',
    default: cardTypeType.TIME,
  })
  @IsNotEmpty()
  type: string;

  @Column({
    comment: '上课次数',
    default: 0,
  })
  time: number;

  @Column({
    comment: '有效期',
    default: 0,
  })
  validityDay: number;

  @Column({
    comment: '所属课程',
  })
  @IsNotEmpty()
  courseId: string;

  @Column({
    comment: '所属机构',
  })
  @IsNotEmpty()
  orgId: string;
}
